//
//  AutherEmterprisePictureTableViewCell.m
//  GLGW_Shoping
//
//  Created by yang on 2018/12/6.
//  Copyright © 2018年 yang. All rights reserved.
//

#import "AutherEmterprisePictureTableViewCell.h"
#import "UpDataImageView.h"

@interface AutherEmterprisePictureTableViewCell ()

@end

@implementation AutherEmterprisePictureTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        GLGWLabel * titleLabel = [[GLGWLabel alloc] initWithFrame:CGRectMake(kWidthProportion_In_iPhoneTriploid(15), kHeightProportion_In_iPhoneTriploid(12), kWidthProportion_In_iPhoneTriploid(120), kHeightProportion_In_iPhoneTriploid(20)) theFont:SYSTEMFONT(14) theColor:kColor_Rule_Black inSuperView:self.contentView];
        titleLabel.text = @"企业资料上传";
        //
        GLGWLabel * tosLabel = [[GLGWLabel alloc] initWithFont:SYSTEMFONT(12) theColor:[UIColor colorWithHexString:@"#999999"] inSuperView:self.contentView];
        tosLabel.text = @"(三证合一请重复上传营业执照)";
        [tosLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView.mas_left).offset(kWidthProportion_In_iPhoneTriploid(15));
            make.top.equalTo(titleLabel.mas_bottom).offset(kHeightProportion_In_iPhoneTriploid(8));
        }];
        //
        GLGWButton * showBookBut = [[GLGWButton alloc] initWithTitleLableFontType:SYSTEMFONT(12) titleColor:kColor_Rule_Yellow inSuperView:self.contentView];
        showBookBut.title = @"查看授权书模板";
        showBookBut.tag = 130;
        [showBookBut mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(self.contentView.mas_right).offset(-kWidthProportion_In_iPhoneTriploid(15));
            make.top.equalTo(self.contentView.mas_top).offset(kHeightProportion_In_iPhoneTriploid(31));
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(27)));
        }];
        [showBookBut addTarget:self action:@selector(pictureAction:) forControlEvents:UIControlEventTouchUpInside];
        //
        CGFloat imageViewWidth = (KScreenWidth - kWidthProportion_In_iPhoneTriploid(50))/3;
        NSArray * imagePlaceArr = @[@"营业执照",@"组织机构代码证",@"税务登记证",@"对公开户许可证",@"授权书"];
        for (int i=0; i<2; i++) {
            for (int j=0; j<3; j++) {
                UpDataImageView * upImageView = [[UpDataImageView alloc] initWithFrame:CGRectMake(kWidthProportion_In_iPhoneTriploid(15)+imageViewWidth*j +kWidthProportion_In_iPhoneTriploid(10)*j, kY_With_View(titleLabel, 37)+ kHeightProportion_In_iPhoneTriploid(105)*i+kHeightProportion_In_iPhoneTriploid(10)*i, imageViewWidth, kHeightProportion_In_iPhoneTriploid(105)) inSuperView:self];
                if (i==0) {
                    upImageView.placeStr = imagePlaceArr[j];
                }else{
                    if (j != 2) {
                        upImageView.placeStr = imagePlaceArr[j+3];
                    }else{
                        [upImageView removeFromSuperview];
                    }
                }
                upImageView.backgroundColor = [UIColor colorWithHexString:@"#F2F2F2"];
            }
        }
        //
        GLGWButton * comfiBut = [[GLGWButton alloc] initWithTitle:@"确认提交" titleLableFont:SYSTEMFONT(16) titleLableColor:[UIColor whiteColor] theCornerRadius:kHeightProportion_In_iPhoneTriploid(22) backgroundColr:[UIColor colorWithHexString:@"#CCCCCC"] inSuperView:self.contentView];
        [comfiBut mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView.mas_left).offset(kWidthProportion_In_iPhoneTriploid(30));
            make.right.equalTo(self.contentView.mas_right).offset(-kWidthProportion_In_iPhoneTriploid(30));
            make.bottom.equalTo(self.contentView.mas_bottom).offset(-kHeightProportion_In_iPhoneTriploid(34));
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(44)));
        }];
        comfiBut.tag = 131;
        [comfiBut addTarget:self action:@selector(pictureAction:) forControlEvents:UIControlEventTouchUpInside];
    }
    return self;
}

-(void)pictureAction:(GLGWButton *)sender{
    if (self.Block_PiceAction) {
        self.Block_PiceAction(sender);
    }
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
